package com.magnificent.atlantis.client.robot;

import com.magnificent.atlantis.client.data.user.UserContext;
import com.magnificent.atlantis.client.ui.planner.PlannerData;
import com.magnificent.atlantis.common.entity.ServerUser;
import com.magnificent.commons.utils.collections.list.MetaList;

/**
 * User: Babanin
 * Date: 13.08.2009
 * Time: 1:07:15
 */
public class RobotContext extends UserContext {

    public static final int DEFAULT_MAX_DAY_PERIOD = 5;
    public static final int DEFAULT_WORK_DAY_START = 8;
    public static final int DEFAULT_WORK_DAY_FINISH = 18;

    private String login;
    private String password;

    private int dayPeriod;
    private int workDayStart;
    private int workDayFinish;

    private MetaList<ServerUser> users;

    public RobotContext(String login, String password) {
        super(null);

        this.login = login;
        this.password = password;
    }

    public RobotContext(String login, String password, PlannerData plannerData) {
        super(plannerData);

        this.login = login;
        this.password = password;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getDayPeriod() {
        if (dayPeriod == 0) {
            dayPeriod = DEFAULT_MAX_DAY_PERIOD;
        }

        return dayPeriod;
    }

    public void setDayPeriod(int dayPeriod) {
        this.dayPeriod = dayPeriod;
    }

    public int getWorkDayStart() {
        if (workDayStart == 0) {
            workDayStart = DEFAULT_WORK_DAY_START;
        }

        return workDayStart;
    }

    public void setWorkDayStart(int workDayStart) {
        this.workDayStart = workDayStart;
    }

    public int getWorkDayFinish() {
        if (workDayFinish == 0) {
            workDayFinish = DEFAULT_WORK_DAY_FINISH;
        }

        return workDayFinish;
    }

    public void setWorkDayFinish(int workDayFinish) {
        this.workDayFinish = workDayFinish;
    }

    public MetaList<ServerUser> getUsers() {
        return users;
    }

    public void setUsers(MetaList<ServerUser> users) {
        this.users = users;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }
}
